<template>
  <el-form :inline="true" :model="formInline" class="demo-form-inline">
    <el-form-item>
      <el-input v-model="formInline.user" label="名称" placeholder="专题名称"></el-input>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="onSubmit">查询</el-button>
      <el-button type="primary" @click="addSubmit">添加</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
//引入api
import {getAdminTopic } from "@/request/api.js";

export default {
  data() {
    return {
      formInline: {}
    };
  },
  // 方法
  methods: {
    onSubmit() {
      getAdminTopic({
        name: this.formInline.user,
        pages: this.$store.state.topic.pageSize,
        currentPage: this.$store.state.topic.currentPage
      }).then(res => {
        this.$store.commit("topic/topicattributeList", res.data);
      });
    },
    addSubmit() {
      this.$router.push("/addtopic");
    }
  }
};
</script>

<style lang='less' scoped>
.el-form {
  background-color: #fff;
}

</style>